import * as electron from "electron";
import * as path from "node:path";

async function main() {
    await electron.app.whenReady();
    let appRoot = electron.app.getAppPath();
    let w = new electron.BrowserWindow({
        width: 550,
        height: 400,
        show: false,
        webPreferences: {preload: path.join(appRoot, "buildout", "index_preload.js")}
    });
    w.menuBarVisible = false;
    await w.loadFile("buildout/src/index/renderer/index.html");
    w.on("closed", () => {
        electron.app.exit(0);
    });
    w.show();
}

main().catch((err) => {
    console.log(err);
});